home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / SecalDemo / Projects / Examples / x_AudioDemo.scl < prev    next >
Text File  |  1998-06-24  |  4KB  |  195 lines

  1. /******************************************************************************\
  2. **  Audio demo (uses Extension) for Secal                                     **
  3. **  Requires Kickstart 2                                                      **
  4. \******************************************************************************/
  5.  
  6.  
  7. go main;
  8.  
  9.  
  10. #-------------------------------------------------------------------------------
  11.  
  12.  
  13. include "ext/ext.inc";                # INTERFACE FOR EXTENSION
  14. inclib "ext/ext.lib";                    # USE EXTENSION LIB
  15.  
  16.  
  17. #*******************************************************************************
  18.  
  19.  
  20. obj mymus:ulong;
  21.  
  22.  
  23. #*******************************************************************************
  24.  
  25.  
  26. main:
  27. x_Init;                                            # INITIALIZE EXTENSION
  28. if d0 then
  29.     x_AudioStart(%1111);            # START AUDIO SUBSYSTEM
  30.     if d0 then
  31.         x_Mus_Load("data/mod.demomusic",%1111); mymus:=a0;    # LOAD AND INIT MUSIC
  32.         if mymus then
  33.             call demo;
  34.         ;
  35.     ;
  36.     x_Done;                                # SHUT DOWN EXTENSION, LET IT CLEAN UP INSTEAD OF US, TOO
  37.                                                 # (MUSIC, ETC)
  38. ;
  39.  
  40. d0.l:=0;
  41. rts;                                                            # MAIN
  42.  
  43.  
  44. #*******************************************************************************
  45.  
  46.  
  47. def TITLE="Secal audio demo";
  48.  
  49.  
  50.  
  51. demo:
  52. push d2;
  53.  
  54. x_WBenchToFront;
  55.  
  56.  
  57. x_EasyRequest(0,TITLE,@text1," Let's see it ");
  58.  
  59.  
  60. x_EasyRequest(0,TITLE,@text2," Ok ");
  61. x_PlaySound(@sound1,@end_sound1-@sound1,0,0,0,216,64);
  62.  
  63.  
  64. x_EasyRequest(0,TITLE,@text3," Come on ");
  65. x_PlaySound(@sound2,@end_sound2-@sound2,@sound2+3610,7650,0,216,64);
  66.  
  67.  
  68. x_EasyRequest(0,TITLE,@text4," Do it ");
  69. x_StopSound(0);
  70.  
  71.  
  72. x_EasyRequest(0,TITLE,@text5," Okay ");
  73. x_PlaySound(@sound2,@end_sound2-@sound2,@sound2+3610,7650,0,428,64);
  74. x_Delay(10);
  75. x_PlaySound(@sound2,@end_sound2-@sound2,@sound2+3610,7650,1,214,64);
  76. x_Delay(10);
  77. x_PlaySound(@sound2,@end_sound2-@sound2,@sound2+3610,7650,2,170,64);
  78. x_Delay(10);
  79. x_PlaySound(@sound2,@end_sound2-@sound2,@sound2+3610,7650,3,143,64);
  80.  
  81.  
  82. x_EasyRequest(0,TITLE,@text6," Nice ");
  83. for d2:=64 downto 0 do
  84.     x_ModifySound(0,64+428-d2,d2);
  85.     x_ModifySound(1,64+214-d2,d2);
  86.     x_ModifySound(2,64+170-d2,d2);
  87.     x_ModifySound(3,64+143-d2,d2);
  88.     x_Delay(3);
  89. ;
  90. x_StopSound(0); x_StopSound(1); x_StopSound(2); x_StopSound(3);
  91.  
  92.  
  93. x_EasyRequest(0,TITLE,@text7," Play it ");
  94. x_Mus_Play(mymus,0);
  95.  
  96.  
  97. x_EasyRequest(0,TITLE,@text8," Stop it ");
  98. x_Mus_Stop(mymus);
  99.  
  100.  
  101. x_EasyRequest(0,TITLE,@text9," Do it ");
  102. x_Mus_Continue(mymus);
  103.  
  104.  
  105. x_EasyRequest(0,TITLE,@text10," Ok ");
  106. x_Mus_Modify(mymus,5,$ffff);
  107.  
  108.  
  109. x_EasyRequest(0,TITLE,@text11," Okay, bye ");
  110. for d2.uw:=$ffff downto $ff step 256 do
  111.     x_Delay(1);
  112.     x_Mus_Modify(mymus,-1,d2);
  113. ;                                                            # MASTER VOLUME LOOP
  114.  
  115.  
  116. x_Mus_Stop(mymus);
  117.  
  118. pop d2;
  119. rts;                                                            # DEMO
  120.  
  121.  
  122. #-------------------------------------------------------------------------------
  123.  
  124.  
  125. text1:
  126. dc.b '   This program tries to demonstrate the
  127. possibilities of the Secal audio extension.',0;
  128.  
  129.  
  130. text2:
  131. dc.b 'After initialization, we can
  132.  handle any sound or music.
  133.  
  134.   Let',39,'s see a simple sound!',0;
  135.  
  136.  
  137. text3:
  138. dc.b 'It is possible to have
  139. a looping sound, too...',0;
  140.  
  141.  
  142. text4:
  143. dc.b 'We can stop the current sound.',0;
  144.  
  145.  
  146. text5:
  147. dc.b 'Let',39,'s see a bit more complex example!',0;
  148.  
  149.  
  150. text6:
  151. dc.b 'We can change the parameters
  152.   of the current sounds.',0;
  153.  
  154.  
  155. text7:
  156. dc.b 'Well, this much about sounds,
  157.   let',39,'s play now a music!',0;
  158.  
  159.  
  160. text8:
  161. dc.b 'We can stop it...',0;
  162.  
  163.  
  164. text9:
  165. dc.b '...Continue it...',0;
  166.  
  167.  
  168. text10:
  169. dc.b '...Jump to any position...',0;
  170.  
  171.  
  172. text11:
  173. dc.b '    And change the master volume.
  174.  
  175. Well, this will be the last thing to show.
  176. Bye for now!',0;
  177.  
  178. align 2;
  179.  
  180.  
  181. #-------------------------------------------------------------------------------
  182.  
  183.  
  184. data_c;
  185.  
  186. sound1:                                    incbin "data/demosound1";
  187. end_sound1:
  188.  
  189. sound2:                                    incbin "data/demosound2";
  190. end_sound2:
  191.  
  192.  
  193. #*******************************************************************************
  194.  
  195.